<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>Document</title>
</head>
<body>

  <div id='app'>
    <input type="text" v-model="msg">
    <input type="text" v-model="obj.a">
  </div>

<script src='https://cdn.bootcdn.net/ajax/libs/vue/2.6.12/vue.js'></script>
<script>
  const app = new Vue({
    el: '#app'
    ,data: {
      msg: 'hello Vue'
      ,obj: {
        a: '111'
        ,b: '222'
      }
    }
    ,methods: {

    }
    ,watch: {
      msg(newVal, oldVal) {
        console.log('msg变化了', newVal);
      }
      // ,'obj.a'(newVal) {
      //   console.log('值改变了', newVal);
      // }
      ,obj:{
        handler(newVal) {
          console.log('值变化了', newVal);
        }
        ,deep: true // 深度监听
      }
    }
  })
</script>
</body>
</html>